import {createApp} from 'vue'
import 'element-plus/dist/index.css'
import App from './App.vue'
//@ts-ignore忽略当前文件ts类型的检测否则有红色提示(打包会失败)
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import 'virtual:svg-icons-register'
import '@/styles/index.scss'
import router from './router'
import pinia from '@/store'
import lodash from 'lodash';

const app = createApp(App)
let VMdEditor: any;
let VuepressTheme: any;
let Prism: any;

if (import.meta.env.PROD) {
    // 生产环境：使用 CDN 全局变量
    VMdEditor = window["VMdEditor"];
    VuepressTheme = window["VMdEditorThemeVuepress"];
    Prism = window["Prism"];
} else {
    // 开发环境：使用本地模块
    VMdEditor = (await import((`@kangc/v-md-editor`))).default;
    VuepressTheme = (await import('@kangc/v-md-editor/lib/theme/vuepress.js')).default;
    Prism = (await import((`prismjs`))).default;
}
VMdEditor.use(VuepressTheme, { Prism });
app.use(VMdEditor);


import gloablComponent from './components/index'

app.use(gloablComponent)
import ElementPlus from 'element-plus'

app.use(ElementPlus, {
    locale: zhCn,
})

app.use(router)
app.use(pinia)
//全局
app.config.globalProperties.$lodash = lodash;
app.mount('#app')
